package Homework2;

public class PrimeSum {
    public static int primeSum(int n) {
        int sum = 0, count = 0;
        for (int i = 2; count != n; i++){
            boolean is = true;
            for (int j = 2; j <= Math.sqrt(i); j++){
                if (i % j == 0){
                    is = false;
                    break;
                }
            }
            if (is){
                count++;
                sum += i;
            }
        }
        return sum;
    }
}
